#include <iostream>
using std::cout;
using std::endl;

class A{
public:
    A(){ cout << "A()" << endl;}
    ~A(){ cout << "~A()" << endl;}
    void print() const{
        cout << "print()" << endl;
    }
};

class B{
public:
    B(){ cout << "B()" << endl;}
    ~B(){ cout << "~B()" << endl;}
    void show() const{
        cout << "show()" << endl;
    }
};

class C{
public:
    C(){ cout << "C()" << endl;}
    ~C(){ cout << "~C()" << endl;}
    void display() const{
        cout << "display()" << endl;
    }
};

class D
//B、C类采取了默认私有继承的方式
//如果要明确使用其他的继承方式，每次继承前都加上限定关键字
/* : public A,B,C */
: public A
, public C
, public B
{
public:
    D(){ cout << "D()" << endl;}
    ~D(){ cout << "~D()" << endl;}
};


void test0(){
    D d;
    d.print();
    d.show();
    d.display();
}

int main(void){
    test0();
    return 0;
}
